<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h3>注册页面</h3>
    <!-- <form action="/register" method="post"> -->
    账号：<input type="text" id=""><br />
    密码：<input type="password" id=""><br />
    <p class="tip"><span></span><a href="./login.html">登录页</a></p>
    <button>注册</button>
    <!-- </form> -->
    <script src="../public/js/ajax.js"></script>
    <script>
        let btn = document.querySelector('button');
        let inps = document.querySelectorAll('input');
        let tip = document.querySelector('.tip span');
        btn.onclick = function () {
            ajax.post('http://localhost/register', `username=${inps[0].value}&pwd=${inps[1].value}`, (data) => {
                tip.innerHTML = data.message;
            });
        }

        
    </script>
</body>

</html>